package gx.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import gx.service.PurchaseItemService;

@Controller
@RequestMapping("/mng/depot")
public class DepotController {
	@Autowired
	private PurchaseItemService purchaseItemService;
	
	@RequestMapping("/warning.jhtml")
	public ModelAndView warning(){//spline  //column
		ModelAndView mav = new ModelAndView("/mng/depot/warning");
		Map<String, String> map_c = purchaseItemService.Storecount2();
		StringBuffer m = new StringBuffer(); // 月份
		StringBuffer data = new StringBuffer(); // 数量
		StringBuffer sn = new StringBuffer(); //sn代表安全数量

		int i = 0;
		for (Map.Entry<String, String> maps : map_c.entrySet()) {
			if (i++ > 0) {
				m.append(",");
				data.append(",");
				sn.append(",");

			}
			m.append("'");
			m.append(maps.getKey());
			m.append("'");
			String[] groutp = maps.getValue().split(",");
			data.append(groutp[0]);
			sn.append(groutp[1]);
		}

		System.out.println(data.toString());
		System.out.println(m.toString());

		System.out.println(sn.toString());
		mav.addObject("cate_zz", m.toString());
		mav.addObject("datas", data.toString());
		mav.addObject("aa", sn.toString());//[2, 30, 25, 40, 25, 30, 15]
		

		return mav;
	}
}
